<div id="add-form" class="form-horizontal" role="form" data-toggle="validator" method="POST" action="">
    <div class="content">
        <div class="panel panel-default panel-intro">

            <div class="panel-body">
                <div id="myTabContent" class="tab-content">
                    <div class="tab-pane fade active in" id="one">
                        <div class="widget-body no-padding">

                            <div class="bootstrap-table">
                                <div class="commonsearch-table ">
                                    <fieldset>
                                        <div class="row">

                                            <div class="form-group col-xs-12 col-sm-6 col-md-4 col-lg-3">
                                                <label for="createtime" class="control-label col-xs-4">录单时间</label>
                                                <div class="col-xs-8">
                                                    <input type="text" class="form-control datetimepicker" name="createtime" value="{:date('Y-m-d H:i:s',$row.createtime)}" placeholder="录单时间" id="createtime" data-index="2">
                                                </div>
                                            </div>
                                            <div class="form-group col-xs-12 col-sm-6 col-md-4 col-lg-3">
                                                <label for="collectiontime" class="control-label col-xs-4">收款期间</label>
                                                <div class="col-xs-8">
                                                    <input type="text" class="form-control datetimepicker" name="collectiontime" value="{:date('Y-m-d H:i:s',time())}" placeholder="录单时间" id="collectiontime" data-index="2">
                                                </div>
                                            </div>

                                            <div class="form-group col-xs-12 col-sm-6 col-md-4 col-lg-3">
                                                <label for="c-storehouse_id" class="control-label col-xs-4">出库仓库</label>
                                                <div class="col-xs-8">
                                                    <input id="c-storehouse_id" data-rule="required" data-source="data/storehouse/index" data-field="name" class="form-control selectpage" name="storehouse_id" type="text" value="{$row.storehouse_id}" disabled>
                                                </div>
                                            </div>
                                            <div class="form-group col-xs-12 col-sm-6 col-md-4 col-lg-3">
                                                <label for="c-customer_id" class="control-label col-xs-4">客户</label>
                                                <div class="col-xs-8">
                                                    <input id="c-customer_id" data-rule="required" data-source="customer/customer/index" data-field="nickname" class="form-control selectpage" name="customer_id" type="text" value="{$row.customer_id}" disabled>
                                                </div>
                                            </div>
                                            <div class="form-group col-xs-12 col-sm-6 col-md-4 col-lg-3">
                                                <label for="company" class="control-label col-xs-4">税点</label>
                                                <div class="col-xs-8">
                                                    <input type="text" class="form-control " name="tax" value="{$row.tax}" placeholder="税点" id="shuifei" data-index="7" onkeyup="checkTaxFloat(this);" disabled>
                                                </div>
                                            </div>
                                            <div class="form-group col-xs-12 col-sm-6 col-md-4 col-lg-3">
                                                <label for="operator" class="control-label col-xs-4">经手人</label>
                                                <div class="col-xs-8">
                                                    <input type="text" class="form-control" name="operator"  placeholder="经手人" id="operator" data-index="6" value="{$admin['nickname']}" disabled>
                                                </div>
                                            </div>
                                            <div class="form-group col-xs-12 col-sm-6 col-md-4 col-lg-3">
                                                <label for="company" class="control-label col-xs-4">部门单位</label>
                                                <div class="col-xs-8">
                                                    <input type="text" class="form-control" name="company"  placeholder="部门单位" id="company" data-index="7" value="{$row.company}" disabled>
                                                </div>
                                            </div>
                                            <div class="form-group col-xs-12 col-sm-6 col-md-4 col-lg-3">
                                                <label for="explain" class="control-label col-xs-4">说明</label><div class="col-xs-8">
                                                <input type="text" class="form-control" name="explain" value="{$row.explain}" placeholder="说明" id="explain" data-index="13">
                                            </div>

                                            </div>
                                            <div class="form-group col-xs-12 col-sm-6 col-md-4 col-lg-3"><label for="abstract" class="control-label col-xs-4">摘要</label><div class="col-xs-8">
                                                <input type="text" class="form-control" name="abstract" value="{$row.abstract}" placeholder="摘要" id="abstract" data-index="14">
                                            </div>
                                            </div>


                                            <br>

                                        </div>
                                </div>
                                </fieldset>
                            </div>
                        </div>



                        </div><div class="columns-right pull-right" style="margin-top:10px;margin-bottom:10px;">
                        </div>
                            <table id="table" class="table table-striped table-bordered table-hover table-nowrap"  data-operate-edit="1" data-operate-del="1" width="100%">
                                <thead>
                                <tr>
                                    <th style="text-align: center; vertical-align: middle; " data-field="id"><div class="th-inner ">Id</div></th>
                                    <!--                                <th style="text-align: center; vertical-align: middle; " data-field="createtime"><div class="th-inner ">出库仓库</div></th>-->
                                    <th style="text-align: center; vertical-align: middle; " ><div class="th-inner ">商品编号</div></th>
                                    <th style="text-align: center; vertical-align: middle; " data-field="number"><div class="th-inner ">商品名称</div></th>
                                    <th style="text-align: center; vertical-align: middle; " data-field="status"><div class="th-inner ">产地</div></th>
                                    <th style="text-align: center; vertical-align: middle; " data-field="supplier_id"><div class="th-inner ">规格</div></th>
                                    <th style="text-align: center; vertical-align: middle; " data-field="operator"><div class="th-inner ">账面库存</div></th>
                                    <th style="text-align: center; vertical-align: middle; " data-field="company"><div class="th-inner ">虚拟库存</div></th>
                                    <th style="text-align: center; vertical-align: middle; " data-field="order_goods_total"><div class="th-inner ">销售数量</div><div class="fht-cell"></div></th>
                                    <th style="text-align: center; vertical-align: middle; " data-field="arrival_total"><div class="th-inner ">销售单位</div><div class="fht-cell"></div></th>
                                    <th style="text-align: center; vertical-align: middle; " data-field="order_price"><div class="th-inner ">销售单价</div><div class="fht-cell"></div></th>
                                    <th style="text-align: center; vertical-align: middle; " data-field="order_price"><div class="th-inner ">销售金额</div><div class="fht-cell"></div></th>
                                    <th style="text-align: center; vertical-align: middle; " data-field="arrival_price"><div class="th-inner ">税点</div><div class="fht-cell"></div></th>
                                    <th style="text-align: center; vertical-align: middle; " data-field="paid_in_price"><div class="th-inner ">含税单价</div><div class="fht-cell"></div></th>
                                    <th style="text-align: center; vertical-align: middle; " data-field="paid_in_price"><div class="th-inner ">税额</div><div class="fht-cell"></div></th>
                                    <!--                                <th style="text-align: center; vertical-align: middle; " data-field="explain"><div class="th-inner ">所有运费</div><div class="fht-cell"></div></th>-->
                                    <!--                                <th style="text-align: center; vertical-align: middle; " data-field="explain"><div class="th-inner ">单件运费</div><div class="fht-cell"></div></th>-->
                                    <th style="text-align: center; vertical-align: middle; " data-field="explain"><div class="th-inner ">合计</div><div class="fht-cell"></div></th>
                                    <th style="text-align: center; vertical-align: middle; " data-field="operate"><div class="th-inner ">备注</div><div class="fht-cell"></div></th>
<!--                                    <th style="text-align: center; vertical-align: middle; " data-field="operate"><div class="th-inner ">操作</div><div class="fht-cell"></div></th>-->
                                </tr>
                                </thead>
                                <tbody data-listidx="0" class="connnn">
                                    {volist name="list" id="vo"}
                                    {if condition="$vo['type'] == 1"}

                                            <tr data-index="0">
                                                <td style="text-align: center; vertical-align: middle; ">
                                                    <input name="row[{$vo.id}][goods_id]" value="{$vo.id}" style="display: none" class="gid gids{$vo.id}">{$vo.id}</td>
                                                <td style="text-align: center; vertical-align: middle; ">{$vo.number}</td>
                                                <td style="text-align: center; vertical-align: middle; " class="title">{$vo.title}</td>
                                                <td style="text-align: center; vertical-align: middle; ">{$vo.place_origin}</td>
                                                <td style="text-align: center; vertical-align: middle; ">{$vo.specs}</td>
                                                <td style="text-align: center; vertical-align: middle; ">0</td>
                                                <td style="text-align: center; vertical-align: middle; ">0</td>
                                                <td style="text-align: center; vertical-align: middle; " class="xxgg">
                                                    <input type="number" style="display: none" class="requisition_num" name="row[{$vo.id}][goods_num]" value="{$vo.goods_num}">
                                                    <span class=" ">{$vo.goods_num}</span>
                                                </td>
                                                <td style="text-align: center; vertical-align: middle; ">个</td>
                                                <td style="text-align: center; vertical-align: middle; " class="">
                                                    <input type="text" class="form-control" style="display: none" value="{$vo.sale_price}" name="row[{$vo.id}][sale_price]" onkeyup="checkInputIntFloat(this);">
                                                    <span class="price ">{$vo.sale_price}</span>
                                                </td>
                                                <td style="text-align: center; vertical-align: middle; " class="allprice">0</td>
                                                <td style="text-align: center; vertical-align: middle; " class="">
                                                    <input type="text" class="form-control" style="display: none" value="{$vo.tax}" name="row[{$vo.id}][tax]" onkeyup="checkTaxFloat(this);">
                                                    <span class="tax">{$vo.tax}</span>
                                                </td>

                                                <td style="text-align: center; vertical-align: middle; " class="ht_price">0</td>
                                                <td style="text-align: center; vertical-align: middle; " class="taxall">0.00</td>
                                                <td style="text-align: center; vertical-align: middle; " class="sfhj">0.00</td>
                                                <td style="text-align: center; vertical-align: middle; " class="xxgg">
                                                    <input type="text" class="form-control" style="display: none" value="" name="row[{$vo.id}][remark]">
                                                    <span class="tremark ">{$vo.remark}</span>
                                                </td>

<!--                                                <td style="text-align: center; vertical-align: middle; ">-->
<!--                                                    <a href="javascript:;" class="btn btn-xs btn-danger btn-delone" data-toggle="tooltip" title="" data-table-id="table" data-field-index="15" data-row-index="0" data-button-index="2" data-original-title="删除"><i class="fa fa-trash"></i></a>-->
<!--                                                    &nbsp;&nbsp;-->
<!--                                                    <a href="javascript:;" class="btn btn-xs btn-success btn-caigou" title="采购" data-table-id="table" data-field-index="13" data-row-index="0" data-button-index="0"><i class="fa fa-shopping-basket"></i></a>-->
<!--                                                </td>-->
                                            </tr>
                                    {else /}
                                    {/if}
                                    {/volist}

                                </tbody>

                                <tbody class="tbfoot" data-listidx="0" style="display: none">
                                    <td style="text-align: center; vertical-align: middle; ">合计</td>
                                    <!--                                        <td style="text-align: center; vertical-align: middle; "></td>-->
                                    <!--                            <td style="text-align: center; vertical-align: middle; "></td>-->
                                    <td style="text-align: center; vertical-align: middle; "></td>
                                    <td style="text-align: center; vertical-align: middle; "></td>
                                    <td style="text-align: center; vertical-align: middle; "></td>
                                    <td style="text-align: center; vertical-align: middle; "></td>
                                    <td style="text-align: center; vertical-align: middle; " class="zstock">0</td>
                                    <td style="text-align: center; vertical-align: middle; " class="xstock">0</td>
                                    <td style="text-align: center; vertical-align: middle; " class="allnum">0</td>
                                    <td style="text-align: center; vertical-align: middle; "></td>
                                    <td style="text-align: center; vertical-align: middle; " ></td>
                                    <td style="text-align: center; vertical-align: middle; "class="alprice">0</td>
                                    <td style="text-align: center; vertical-align: middle; "></td>
                                    <td style="text-align: center; vertical-align: middle; "></td>
                                    <td style="text-align: center; vertical-align: middle; "class="alltax">0</td>
                                    <!--                            <td style="text-align: center; vertical-align: middle; "class="fare">0</td>-->
                                    <!--                            <td style="text-align: center; vertical-align: middle; "class="cost"></td>-->
                                    <td style="text-align: center; vertical-align: middle; "class="price_tax">0</td>
                                    <td style="text-align: center; vertical-align: middle; "></td>
<!--                                    <td style="text-align: center; vertical-align: middle; "></td>-->
                                </tbody>
                            </table>
                        </div>

<!--                        <div class="fixed-table-toolbar"><div class="bs-bars pull-left"><div id="toolbar" class="toolbar" style="position: relative;">-->
<!--                               <a href="javascript:;" class="btn btn-success btn-add " title="添加"><i class="fa fa-plus"></i> 添加</a>-->
<!--                         </div>-->



                                        </div><div class="columns-right pull-right" style="margin-top:10px;margin-bottom:10px;">
                                        </div>
                                            <table id="table1" class="table table-striped table-bordered table-hover table-nowrap"  data-operate-edit="1" data-operate-del="1" width="100%">
                                                <thead>
                                                <tr>
                                                    <th style="text-align: center; vertical-align: middle; " data-field="id"><div class="th-inner ">Id</div></th>
                                                    <!--                                <th style="text-align: center; vertical-align: middle; " data-field="createtime"><div class="th-inner ">出库仓库</div></th>-->
                                                    <th style="text-align: center; vertical-align: middle; " ><div class="th-inner ">商品编号</div></th>
                                                    <th style="text-align: center; vertical-align: middle; " data-field="number"><div class="th-inner ">商品名称</div></th>
                                                    <th style="text-align: center; vertical-align: middle; " data-field="status"><div class="th-inner ">产地</div></th>
                                                    <th style="text-align: center; vertical-align: middle; " data-field="supplier_id"><div class="th-inner ">规格</div></th>
                                                    <th style="text-align: center; vertical-align: middle; " data-field="operator"><div class="th-inner ">账面库存</div></th>
                                                    <th style="text-align: center; vertical-align: middle; " data-field="company"><div class="th-inner ">虚拟库存</div></th>
                                                    <th style="text-align: center; vertical-align: middle; " data-field="order_goods_total"><div class="th-inner ">销售数量</div><div class="fht-cell"></div></th>
                                                    <th style="text-align: center; vertical-align: middle; " data-field="arrival_total"><div class="th-inner ">销售单位</div><div class="fht-cell"></div></th>
                                                    <th style="text-align: center; vertical-align: middle; " data-field="order_price"><div class="th-inner ">销售单价</div><div class="fht-cell"></div></th>
                                                    <th style="text-align: center; vertical-align: middle; " data-field="order_price"><div class="th-inner ">销售金额</div><div class="fht-cell"></div></th>
                                                    <th style="text-align: center; vertical-align: middle; " data-field="arrival_price"><div class="th-inner ">税点</div><div class="fht-cell"></div></th>
                                                    <th style="text-align: center; vertical-align: middle; " data-field="paid_in_price"><div class="th-inner ">含税单价</div><div class="fht-cell"></div></th>
                                                    <th style="text-align: center; vertical-align: middle; " data-field="paid_in_price"><div class="th-inner ">税额</div><div class="fht-cell"></div></th>
                                                    <!--                                <th style="text-align: center; vertical-align: middle; " data-field="explain"><div class="th-inner ">所有运费</div><div class="fht-cell"></div></th>-->
                                                    <!--                                <th style="text-align: center; vertical-align: middle; " data-field="explain"><div class="th-inner ">单件运费</div><div class="fht-cell"></div></th>-->
                                                    <th style="text-align: center; vertical-align: middle; " data-field="explain"><div class="th-inner ">合计</div><div class="fht-cell"></div></th>
                                                    <th style="text-align: center; vertical-align: middle; " data-field="operate"><div class="th-inner ">备注</div><div class="fht-cell"></div></th>
<!--                                                    <th style="text-align: center; vertical-align: middle; " data-field="operate"><div class="th-inner ">操作</div><div class="fht-cell"></div></th>-->
                                                </tr>
                                                </thead>
                                                <tbody data-listidx="0" class="connnn1">

                                                {volist name="list" id="vo"}
                                                {if condition="$vo['type'] == 2"}
                                                    <tr data-index="0">
                                                        <td style="text-align: center; vertical-align: middle; ">
                                                            <input name="row[{$vo.id}][goods_id]" value="{$vo.id}" style="display: none" class="gid gids{$vo.id}">{$vo.id}</td>
                                                        <td style="text-align: center; vertical-align: middle; ">{$vo.number}</td>
                                                        <td style="text-align: center; vertical-align: middle; " class="title">{$vo.title}</td>
                                                        <td style="text-align: center; vertical-align: middle; ">{$vo.place_origin}</td>
                                                        <td style="text-align: center; vertical-align: middle; ">{$vo.specs}</td>
                                                        <td style="text-align: center; vertical-align: middle; ">0</td>
                                                        <td style="text-align: center; vertical-align: middle; ">0</td>
                                                        <td style="text-align: center; vertical-align: middle; " class="xxgg">
                                                            <input type="number" style="display: none" class="requisition_num" name="row[{$vo.id}][goods_num]" value="{$vo.goods_num}">
                                                            <span class=" ">{$vo.goods_num}</span>
                                                        </td>
                                                        <td style="text-align: center; vertical-align: middle; ">个</td>
                                                        <td style="text-align: center; vertical-align: middle; " class="">
                                                            <input type="text" class="form-control" style="display: none" value="{$vo.sale_price}" name="row[{$vo.id}][sale_price]" onkeyup="checkInputIntFloat(this);">
                                                            <span class="price ">{$vo.sale_price}</span>
                                                        </td>
                                                        <td style="text-align: center; vertical-align: middle; " class="allprice">0</td>
                                                        <td style="text-align: center; vertical-align: middle; " class="">
                                                            <input type="text" class="form-control" style="display: none" value="{$vo.tax}" name="row[{$vo.id}][tax]" onkeyup="checkTaxFloat(this);">
                                                            <span class="tax">{$vo.tax}</span>
                                                        </td>

                                                        <td style="text-align: center; vertical-align: middle; " class="ht_price">0</td>
                                                        <td style="text-align: center; vertical-align: middle; " class="taxall">0.00</td>
                                                        <td style="text-align: center; vertical-align: middle; " class="sfhj">0.00</td>
                                                        <td style="text-align: center; vertical-align: middle; " class="xxgg">
                                                            <input type="text" class="form-control" style="display: none" value="" name="row[{$vo.id}][remark]">
                                                            <span class="tremark ">{$vo.remark}</span>
                                                        </td>

<!--                                                        <td style="text-align: center; vertical-align: middle; ">-->
<!--                                                            <a href="javascript:;" class="btn btn-xs btn-danger btn-delone" data-toggle="tooltip" title="" data-table-id="table" data-field-index="15" data-row-index="0" data-button-index="2" data-original-title="删除"><i class="fa fa-trash"></i></a>-->
<!--                                                            &nbsp;&nbsp;-->
<!--                                                            <a href="javascript:;" class="btn btn-xs btn-success btn-caigou" title="采购" data-table-id="table" data-field-index="13" data-row-index="0" data-button-index="0"><i class="fa fa-shopping-basket"></i></a>-->
<!--                                                        </td>-->
                                                    </tr>
                                                {else /}
                                                {/if}
                                                {/volist}
                                                </tbody>

                                                <tbody class="tbfoot1" data-listidx="0" style="display: none">
                                                    <td style="text-align: center; vertical-align: middle; ">合计</td>
                                                    <!--                                        <td style="text-align: center; vertical-align: middle; "></td>-->
                                                    <!--                            <td style="text-align: center; vertical-align: middle; "></td>-->
                                                    <td style="text-align: center; vertical-align: middle; "></td>
                                                    <td style="text-align: center; vertical-align: middle; "></td>
                                                    <td style="text-align: center; vertical-align: middle; "></td>
                                                    <td style="text-align: center; vertical-align: middle; "></td>
                                                    <td style="text-align: center; vertical-align: middle; " class="zstock1">0</td>
                                                    <td style="text-align: center; vertical-align: middle; " class="xstock1">0</td>
                                                    <td style="text-align: center; vertical-align: middle; " class="allnum1">0</td>
                                                    <td style="text-align: center; vertical-align: middle; "></td>
                                                    <td style="text-align: center; vertical-align: middle; " ></td>
                                                    <td style="text-align: center; vertical-align: middle; "class="alprice1">0</td>
                                                    <td style="text-align: center; vertical-align: middle; "></td>
                                                    <td style="text-align: center; vertical-align: middle; "></td>
                                                    <td style="text-align: center; vertical-align: middle; "class="alltax1">0</td>
                                                    <!--                            <td style="text-align: center; vertical-align: middle; "class="fare">0</td>-->
                                                    <!--                            <td style="text-align: center; vertical-align: middle; "class="cost"></td>-->
                                                    <td style="text-align: center; vertical-align: middle; "class="price_tax1">0</td>
                                                    <td style="text-align: center; vertical-align: middle; "></td>
<!--                                                    <td style="text-align: center; vertical-align: middle; "></td>-->
                                                </tbody>
                                            </table>
                                        </div>
                    </div>
                </div>

            </div>
        </div>
    </div>
    </div>
</div>
<script src="https://cdn.bootcdn.net/ajax/libs/jquery/3.5.1/jquery.js"></script>
<script>
    var tax = 0;
    // getrequisition(8)
    // getrequisition(7)
    // getrequisition(6)
    function getrequisition(sid){
        // var tclass = '.gids'+sid;
        // if($('input').is('.gids'+sid)){
        //     layer.msg('该商品已添加')
        //     return false;
        // }
        var url = "{$turl}"
        $.post(url+'/sales/slip/getgood',{ids:sid},function (res) {
            if(res != null){
                f(res)
            }else{
                layer.msg('数据异常')
                return false;
            }

        })
    }
    function f(res) {
        $('.tbfoot1').attr('style','display:')
        var str = '';
        str += '<tr data-index="0">\n' +

            // ' <td class="bs-checkbox ">\n' +
            // '     <input data-index="0" name="btSelectItem" type="checkbox">\n' +
            // '<input name="row['+res.id+']['+'specs_ids'+']" value="'+res.id+'" style="display: none" class="gids'+res.id+'">'+
            // ' </td>\n' +
            ' <td style="text-align: center; vertical-align: middle; ">' +
            '<input name="crow['+res.id+']['+'goods_id'+']" value="'+res.id+'" style="display: none" class="gid gids'+res.id+'">' +
            ''+res.id+'</td>\n' +
            ' <td style="text-align: center; vertical-align: middle; ">'+res.number+'</td>\n' +
            // ' <td style="text-align: center; vertical-align: middle; ">'+res.number+'</td>\n' +
            ' <td style="text-align: center; vertical-align: middle; " class="title">'+res.title+'</td>\n' +
            ' <td style="text-align: center; vertical-align: middle; ">'+res.place_origin+'</td>\n' +
            ' <td style="text-align: center; vertical-align: middle; ">'+res.specs+'</td>\n' +
            ' <td style="text-align: center; vertical-align: middle; ">0</td>\n' +
            ' <td style="text-align: center; vertical-align: middle; ">0</td>\n' +
            ' <td style="text-align: center; vertical-align: middle; " class="xxgg">' +
            '<input type="number" style="display: none" class="requisition_num" name="crow['+res.id+']['+'goods_num'+']" value="">'+
            '<span class=" ">0</span></td>\n' +
            ' <td style="text-align: center; vertical-align: middle; ">'+res.unit+'</td>\n' +
            ' <td style="text-align: center; vertical-align: middle; " class="xxgg">' +
            '<input type="text" class="form-control " style="display: none" value="'+res.price+'" name="crow['+res.id+']['+'sale_price'+']" onkeyup="checkInputIntFloat(this);">' +
            '<span class="price">'+res.price+'</span></td>\n' +
            '</td>\n' +
            ' <td style="text-align: center; vertical-align: middle; " class="allprice">0</td>\n' +
            ' <td style="text-align: center; vertical-align: middle; " class="xxgg">' +
            '<input type="text" class="form-control" style="display: none" value="" name="crow['+res.id+']['+'tax'+']" >' +
            '<span class="tax ">0</span></td>\n' +
            '</td>\n' +
            ' <td style="text-align: center; vertical-align: middle; " class="ht_price">0\n' +
            ' <td style="text-align: center; vertical-align: middle; " class="taxall">0\n' +
            ' <td style="text-align: center; vertical-align: middle; " class="sfhj">0\n' +
            ' <td style="text-align: center; vertical-align: middle; " class="xxgg">' +
            '<input type="text" class="form-control" style="display: none" value="" name="crow['+res.id+']['+'remark'+']" >' +
            '<span class="tremark ">无</span></td>\n' +
            '</td>\n' +
            ' <td style="text-align: center; vertical-align: middle; ">\n' +
            ' <a href="javascript:;" class="btn btn-xs btn-danger btn-delone" data-toggle="tooltip" title="" data-table-id="table" data-field-index="15" data-row-index="0" data-button-index="2" data-original-title="删除"><i class="fa fa-trash"></i></a>&nbsp&nbsp' +
            '<a href="javascript:;" class="btn btn-xs btn-success btn-caigou" title="采购" data-table-id="table" data-field-index="13" data-row-index="0" data-button-index="0"><i class="fa fa-shopping-basket"></i></a>'
        '</td>\n' +
        '</tr>'
        $('#table1').find('.connnn1').append(str);

    }

    var is_check = 0;
    $('.subpurchase').click(function () {
        if(is_check == 0){
            var noticename = '';
            $('.connnn').find("tr").each(function(){
                var anum = $(this).find('.requisition_num').val()
                if(anum < 1 ){
                    noticename += $(this).find('.title').html() +'&nbsp'
                }

            });
            console.log('问题商品:'+noticename)
            if(noticename != ''){
                layer.msg(noticename+'未设置数量？')
                // layer.confirm(noticename+'未设置金额 数量？', {
                //     btn: ['跳过','设置'] //按钮
                // }, function(){
                //     is_check = 1;
                //     $('.subpurchase').click()
                // }, function(){
                //
                // });
                return false;
            }else{

            }
        }
    })
    $('body').on('click','.btn-caigou',function () {
        var gid = $(this).parents('tr').find('.gid').val()
        var url = "{$turl}"
        layer.open({
            type: 2, // 1-在content中写html代码， 2-在content中写src路径
            area: ['50%', '90%'],
            title: "采购商品",
            content: url+'/goods/goods/addpgoods?ids='+gid,
            // content: Config.this_url+'/purchase/requisition',
        })
    })
</script>
{include file='common/footer' /}
{include file='common/footer1' /}